package cn.tedu.boot04.controller;

import cn.tedu.boot04.entity.Product;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios(String name,int age){
        return "哈撒kname="+name+"age="+age ;
    }

    //如果发出的请求方式为post请求并且传递过来的是自定义Js对象接受参数时需要添加@RequestBody
    @RequestMapping("/postAxios ")
    public String postAxios(@RequestBody Product product){
        return "所里阿克陶info="+product.toString();
    }
}
